package j2metris.pieces;

import j2metris.Coordinate;
import j2metris.game.Game;
import j2metris.ControllablePiece;
import javax.microedition.lcdui.Image;

class O extends ControllablePiece
{
    private static final Coordinate[] coordinates =
    {
        new Coordinate(0, 0),
        new Coordinate(1, 0),
        new Coordinate(0, 1),
        new Coordinate(1, 1)
    };

    public void rotateClockwise() {}

    public void rotateCounterclockwise() {}

    public Coordinate[] getRotationState()
    {
        Coordinate[] copy = new Coordinate[4];
        for(int i = 0; i < coordinates.length; ++i)
        {
            copy[i] = coordinates[i];
        }
        return coordinates;
    }

    public Coordinate[] getRotationState(int distanceFromCurrentState)
    {
        return getRotationState();
    }

    public ControllablePiece clone()
    {
        return new O();
    }

    private static final int[] arbg =
            new int[Game.getInstance().getUnitWidth() *
            Game.getInstance().getUnitHeight()];
    static
    {
        for(int i = 0; i < arbg.length; ++i)
        {
            arbg[i] = 0xFFFFFF00;
        }
    }
    private static final Image image = Image.createRGBImage(
            arbg,
            Game.getInstance().getUnitWidth(),
            Game.getInstance().getUnitHeight(),
            false);

    public Image getUnitImage()
    {
        return image;
    }

    public String toString()
    {
        return "O";
    }

    public Coordinate[][] getRotationStates()
    {
        Coordinate[] statesCopy = new Coordinate[4];
        for(int i = 0; i < 4; ++i)
        {
            statesCopy[i] = coordinates[i];
        }
        Coordinate[][] ret = {statesCopy};
        return ret;
    }
}
